package design.factory.factoryMethod;

public class MachineGun implements Gun {
    private volatile int bulletC = 120;
    public MachineGun() {
    }
    public MachineGun(int c){
        this.bulletC = c;
    }
    @Override
    public void shoot() {
        for(;bulletC>0;) {
            System.out.println("嗒嗒嗒");
            synchronized (this) {
                bulletC -= 3;
            }
            try {
                Thread.sleep(200);// 西门吃屎一秒15口
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
